<template>
	<view class="overdue">
		<view class="overdueItem" v-for="item in data" :key="item.Id" @click="toWebView(item.Id,item.billlistId)">
			<view class="cell">
				<view class="lable">
					客户: {{item.cCusName}}
				</view>
			</view>
			<view class="cell">
				<view class="lable">
					日期: {{item.CreateTime}}
				</view>
			</view>
			<view class="cell">
				<view class="lable">
					地址: {{item.cCusAddress || '暂无地址'}}
				</view>
			</view>
			<view class="cell">
				<view class="lable">
					金额: ￥<text>{{momenyFormat(item.TotalSum)}}</text>
				</view>
			</view>
			<view class="cell">
				<view class="lable">
					逾期天数: {{item.OverdueDay}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		momenyFormat
	} from '@/util/util.js'
	export default {
		data() {
			return {
				data: []
			}
		},
		onLoad(query) {
			this.$http('post', '/BO/BIlling/GetBIllingList?CustomerId=' + query.CustomerId).then(res => {
				console.log(res);
				if (!res.Success) return this.$api.msg(res.Msg)
				this.data = res.Data
			})
		},
		methods: {
			momenyFormat(num) {
				return momenyFormat(num)
			},
			toWebView(Id, billId) {
				uni.navigateTo({
					url: '/pages/webview/webview?Id=' + Id + '&billId=' + billId + '&type=overdue'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.overdue {
		padding: 20rpx;
		box-sizing: border-box;
		height: 100%;
		width: 100%;
		background-image: url('/static/background.png');
		background-size: cover;

		.overdueItem {
			border-radius: 10rpx;
			background-color: #fff;
			margin-bottom: 20rpx;
			padding: 10rpx;
			box-sizing: border-box;
			line-height: 2;

			.cell {
				display: flex;

				text {
					font-weight: bold;
					font-size: 16px;
				}
			}
		}

	}
</style>